package com.lds.erp.gateway.filter;

import com.dph.common.utils.utils.AppUtils;

/**
 * @author hongsir
 * @apiNote 过滤器常数
 * @date 2018/10/12 上午10:35
 */
public class FilterConstants {
    /**
     * ajaxOnly 为true时，token失效时只返回json格式错误信息
     */
    public final static Boolean AJAX_ONLY = Boolean.FALSE;
    /**
     * 跨域检测方法
     */
    public final static String CROSS_METHOD = "OPTIONS";
    /**
     * 需要转换request的方法
     */
    public final static String CONVERT_METHOD = "POST";
    /**
     * 未登录重定向
     */
    public final static String NOT_LOGIN_REDIRECT = "/api/common/check_token";
    /**
     * 允许不登录直接访问的路径,有则追加
     */
    public final static String[] FILTER_1_ALLOWED_NOT_LOGIN_PATHS = {"/api/common/*", "/api/demo/*", "/swagger-resources", "/doc.html","/api/app/pay/*","/api/banner/*","/api/product/*","/api/order/cart/cart_num","/api/order/order/jhpay_info"};
    /**
     * 允许不授权直接访问的路径,即需要登录无需授权的接口,有则追加
     */
    public final static String[] FILTER_2_ALLOWED_NOT_GRANT_PATHS = {"/api/user/account/*"};
    /**
     * 无需登录和无需授权的接口
     */
    public final static String[] FILTER_1_AND_2_ALLOWED_PATHS = AppUtils.concatAll(FILTER_1_ALLOWED_NOT_LOGIN_PATHS, FILTER_2_ALLOWED_NOT_GRANT_PATHS);

}
